app.controller("baseController",function ($scope) {
    $scope.paginationConf={
        currentPage:1,
        totalItems:10,
        itemsPerPage:10,
        perPageOptions:[10,20,30,40,50],
        onChange:function () {
            $scope.reloadList();
        }
    }

    //刷新数据
    $scope.reloadList=function(){
        $scope.search( $scope.paginationConf.currentPage,$scope.paginationConf.itemsPerPage)
    }

    //用户要删除品牌的id集合
    $scope.selectIds=[];
    $scope.selectClicked=function ($event,id) {
        if ($event.target.checked){
            $scope.selectIds.push(id)
        }else {
            var index=$scope.selectIds.indexOf(id);
            if (index>-1){
                $scope.selectIds.splice(index,1)
            }
        }
    }

    //json数据把其中一个变量转换为字符串
    $scope.jsonToString=function(jsonString,key){

        var json= JSON.parse(jsonString);
        var value="";

        for(var i=0;i<json.length;i++){
            if(i>0){
                value+=",";
            }
            value +=json[i][key];
        }

        return value;
    }
})